% /*******************************************************************************
%  * Main Simulation Routine
%  * *****************************************************************************
%  * @param lower
%  * @param upper
%  * @param m
%  * @param n
%  * @param r
%  * @param k
%  * @param q
%  * @param t
%  * @param z
%  */
function [f max_err] = get_err_mn(lower,upper,m,n,r,k)

f = 0.0;
max_err = 0.0;
f_prev = f; max_err_prev = max_err;
step = 2^(-(n+k));

while (max_err <= max_err_prev)                                                                                                  
    max_err_prev = max_err;
    max_err = get_max_err(lower, upper, m, n, r, k, f);
end

max_err_s = min(e_star_f);                                                        